package com.mc.gpm.service.impl;

import java.util.List;
import com.mc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mc.gpm.mapper.GpmStorageMapper;
import com.mc.gpm.domain.GpmStorage;
import com.mc.gpm.service.IGpmStorageService;

/**
 * 种质资源库Service业务层处理
 *
 * @author mc
 * @date 2021-03-19
 */
@Service
public class GpmStorageServiceImpl implements IGpmStorageService
{
    @Autowired
    private GpmStorageMapper gpmStorageMapper;

    /**
     * 查询种质资源库
     *
     * @param storageId 种质资源库ID
     * @return 种质资源库
     */
    @Override
    public GpmStorage selectGpmStorageById(String storageId)
    {
        return gpmStorageMapper.selectGpmStorageById(storageId);
    }

    /**
     * 查询种质资源库列表
     *
     * @param gpmStorage 种质资源库
     * @return 种质资源库
     */
    @Override
    public List<GpmStorage> selectGpmStorageList(GpmStorage gpmStorage)
    {
        return gpmStorageMapper.selectGpmStorageList(gpmStorage);
    }

    /**
     * 新增种质资源库
     *
     * @param gpmStorage 种质资源库
     * @return 结果
     */
    @Override
    public int insertGpmStorage(GpmStorage gpmStorage)
    {
        gpmStorage.setCreateTime(DateUtils.getNowDate());
        return gpmStorageMapper.insertGpmStorage(gpmStorage);
    }

    /**
     * 修改种质资源库
     *
     * @param gpmStorage 种质资源库
     * @return 结果
     */
    @Override
    public int updateGpmStorage(GpmStorage gpmStorage)
    {
        gpmStorage.setUpdateTime(DateUtils.getNowDate());
        return gpmStorageMapper.updateGpmStorage(gpmStorage);
    }

    /**
     * 批量删除种质资源库
     *
     * @param storageIds 需要删除的种质资源库ID
     * @return 结果
     */
    @Override
    public int deleteGpmStorageByIds(String[] storageIds)
    {
        return gpmStorageMapper.deleteGpmStorageByIds(storageIds);
    }

    /**
     * 删除种质资源库信息
     *
     * @param storageId 种质资源库ID
     * @return 结果
     */
    @Override
    public int deleteGpmStorageById(String storageId)
    {
        return gpmStorageMapper.deleteGpmStorageById(storageId);
    }

    @Override
    public int countGpmStorageByShelveNumber(String shelveNumber) {
        return gpmStorageMapper.countGpmStorageByShelveNumber(shelveNumber);
    }
}